<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>6-将数组拆分拼接为字符串，并且用 # 分割</title>
	</head>
	<body>
		<script type="text/javascript">
			//初始化一个空数组并且给数组赋值(元素)
			var empty = [];
			empty[0] = '红色';
			empty[1] = '128G';
			empty[2] = '公开版';
			empty[3] ='标配';
			empty[4] ='5.6英寸';
			//Array(5) [ "红色", "128G", "公开版", "标配", "5.6英寸" ]
			console.log(empty)
			
			//循环添加#
			//定义一个字符串的变量去接收
			var str = '';
			if(empty.length>0){
				for(var i=0;i<empty.length;i++){
					str+=empty[i]+'#';
				}
			}
			//红色#128G#公开版#标配#5.6英寸#
			alert(str);
			
		</script>
		
		<span>颜色: <i>红色</i></span>
		<span>内存: <i>128G</i></span>
		<span>购买方式: <i>公开版</i></span>
		<span>配置: <i>标配</i></span>
		<span>尺寸: <i>5.6英寸</i></span>
		
		
	</body>
</html>
